import React, { useState } from 'react'
import { ThemeContext } from './ThemeContext'
import { Button, View } from 'react-native'
import PageView from './PageView'

export default function RootView() {


  const [ theme , setTheme ] = useState('dark')

  const changeTheme = () => {
    if(theme === 'dark'){
      setTheme('light')
    }else{
      setTheme('dark')
    }
  }


  return (
    <ThemeContext.Provider value={theme} >
      <Button title='change theme' onPress={changeTheme} />
      <View style={{width:'100%' , marginTop:20}}>
        <PageView/>
      </View>

    </ThemeContext.Provider>
  )
}
